<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            color: lime;
        }
        main {
            width: 100%;
            height: 100%;
            position: relative;
        }
        body {
            overflow: hidden;
            background: black;
            height: 100vh;
            width: 100vw;
        }
        div {
            width: 12px;
            display: inline-block;
            font-size: 12px;
            /* 允许长单词换行到下一行 */
            word-wrap: break-word;
            /* 设置字符之间的间距 */
            letter-spacing: 12px;
            position: absolute;
            animation: run 8s ease-in;
        }
        span {
            position: absolute;
            top: 0;
            left: 0;
            background-image: linear-gradient(black,transparent);
            width: 12px;
            height: 100%;
        }
        @keyframes run {
            100% {
                top: 100%;
            }
        }
    </style>
</head>

<body>
    <main id="main">
    </main>
</body>
<script>
    function Numbers(min,max) { //返回min-max之间的数字
        let num = Math.floor(Math.random()*(max-min+1)+min)
        return num //返回一个min - max 之间的随机数
    }
    function Strings() { //生成30-50位数随机字符串  并返回
        let strings = 'iasdhqwinfquwydqvlfzfawioeWIEUFBLibEFLbseuFBEUfluEFBIUEW1634836451'
        let allarrs =strings.split('')
        let i = Numbers(30,50)
        let arr=[]
        for (let j = 0; j < i; j++) {
            let arrindex = Numbers(0,allarrs.length-1)
            arr[j]=allarrs[arrindex]
        }
        let strarr = arr.join('')
        return strarr 
    }
    function Addele() { //向文档中添加标签
        let divele = document.createElement('div')
        divele.style.top='-'+Numbers(100,200)+'%'
        divele.style.left= Numbers(1,99)+'%'
        divele.innerHTML=Strings()+'<span></span>'
        main.appendChild(divele)
        divele.addEventListener('animationend',function () {//并给所有的div添加动画结束事件
                this.remove()//删除这个div
            })
    }
    setInterval(Addele,70)

</script>
</html>